From 474b2afc341c769fa8418c39a29b08807b662bdd Mon Sep 17 00:00:00 2001 From: robertl Date: Tue, 4 Oct 2005 14:11:17 +0000 Subject: [PATCH] More aggressively 'static'-ize module internal data. --- gpsbabel/an1.c | 8 ++++---- gpsbabel/bcr.c | 4 ++-- gpsbabel/cetus.c | 4 ++-- gpsbabel/coastexp.c | 4 ++-- gpsbabel/copilot.c | 4 ++-- gpsbabel/coto.c | 2 +- gpsbabel/cst.c | 6 +++--- gpsbabel/csv_util.c | 6 ++++++ gpsbabel/csv_util.h | 2 +- gpsbabel/gcdb.c | 4 ++-- gpsbabel/gdb.c | 2 +- gpsbabel/geo.c | 4 ++-- gpsbabel/globals.c | 2 +- gpsbabel/google.c | 2 +- gpsbabel/gpilots.c | 4 ++-- gpsbabel/gpspilot.c | 4 ++-- gpsbabel/gpx.c | 2 +- gpsbabel/hsa_ndv.c | 6 +++--- gpsbabel/ignrando.c | 2 +- gpsbabel/kml.c | 4 ++-- gpsbabel/magnav.c | 4 ++-- gpsbabel/magproto.c | 6 +++--- gpsbabel/msroute.c | 4 ++-- gpsbabel/navicache.c | 4 ++-- gpsbabel/nmn5.c | 2 +- gpsbabel/ozi.c | 2 +- gpsbabel/pathaway.c | 8 ++++---- gpsbabel/position.c | 2 +- gpsbabel/quovadis.c | 2 +- gpsbabel/tef_xml.c | 4 ++-- gpsbabel/tiger.c | 8 ++++---- gpsbabel/waypt.c | 2 +- 32 files changed, 65 insertions(+), 59 deletions(-) diff --git a/gpsbabel/an1.c b/gpsbabel/an1.c index 7ab321d3f..2de011aa0 100644 --- a/gpsbabel/an1.c +++ b/gpsbabel/an1.c @@ -26,15 +26,15 @@ #define MYNAME "an1" #include "defs.h" -FILE *infile; -FILE *outfile; +static FILE *infile; +static FILE *outfile; static char *output_type = NULL; static char *road_changes = NULL; static char *nogc = NULL; -short output_type_num = 0; +static short output_type_num = 0; -short last_read_type = 0; +static short last_read_type = 0; static long serial=10000; static long rtserial=1; diff --git a/gpsbabel/bcr.c b/gpsbabel/bcr.c index e1e26a9c3..302cfca3a 100644 --- a/gpsbabel/bcr.c +++ b/gpsbabel/bcr.c @@ -46,8 +46,8 @@ */ static FILE *fin, *fout; -char *filename; -int curr_rte_num, target_rte_num; +static char *filename; +static int curr_rte_num, target_rte_num; static double radius; /* placeholders for options */ diff --git a/gpsbabel/cetus.c b/gpsbabel/cetus.c index 7aca01cdc..3596244fb 100644 --- a/gpsbabel/cetus.c +++ b/gpsbabel/cetus.c @@ -139,8 +139,8 @@ typedef struct cetus_track_point_s static FILE *file_in; static FILE *file_out; static const char *out_fname; -struct pdb *opdb; -struct pdb_record *opdb_rec; +static struct pdb *opdb; +static struct pdb_record *opdb_rec; static void *mkshort_wr_handle; static char *dbname = NULL; diff --git a/gpsbabel/coastexp.c b/gpsbabel/coastexp.c index d3d6b195f..4f2d35af5 100755 --- a/gpsbabel/coastexp.c +++ b/gpsbabel/coastexp.c @@ -28,8 +28,8 @@ static XML_Parser psr; #include "uuid.h" -FILE *fd; -FILE *ofd; +static FILE *fd; +static FILE *ofd; #define MYNAME "coastexp" #define MY_CBUF 4096 diff --git a/gpsbabel/copilot.c b/gpsbabel/copilot.c index 0527c5644..c2828fdad 100644 --- a/gpsbabel/copilot.c +++ b/gpsbabel/copilot.c @@ -41,8 +41,8 @@ struct record { static FILE *file_in; static FILE *file_out; static const char *out_fname; -struct pdb *opdb; -struct pdb_record *opdb_rec; +static struct pdb *opdb; +static struct pdb_record *opdb_rec; static void rd_init(const char *fname) diff --git a/gpsbabel/coto.c b/gpsbabel/coto.c index 7498212b0..9184a0c2b 100644 --- a/gpsbabel/coto.c +++ b/gpsbabel/coto.c @@ -88,7 +88,7 @@ static FILE *file_in; static FILE *file_out; static const char *out_fname; static const char *in_fname; /* We might need that for naming tracks */ -struct pdb *opdb; +static struct pdb *opdb; static char *trackname = NULL; static char *zerocat = NULL; diff --git a/gpsbabel/cst.c b/gpsbabel/cst.c index f33582242..0e11ec8bc 100644 --- a/gpsbabel/cst.c +++ b/gpsbabel/cst.c @@ -38,10 +38,10 @@ #define CST_REFERENCE 4 #define CST_VERSION 5 -static FILE *fin, *fout; -char *fin_name, *fout_name; +static FILE *fin; +static char *fin_name; -route_head *temp_route; +static route_head *temp_route; /* placeholders for options */ diff --git a/gpsbabel/csv_util.c b/gpsbabel/csv_util.c index b7be5ae40..78842a794 100644 --- a/gpsbabel/csv_util.c +++ b/gpsbabel/csv_util.c @@ -38,6 +38,12 @@ #define EXCEL_TO_TIMET(a) ((a - 25569.0) * 86400.0) #define TIMET_TO_EXCEL(a) ((a / 86400.0) + 25569.0) + +/****************************************************************************/ +/* obligatory global struct */ +/****************************************************************************/ +xcsv_file_t xcsv_file = {}; + extern char *xcsv_urlbase; extern char *prefer_shortnames; diff --git a/gpsbabel/csv_util.h b/gpsbabel/csv_util.h index a4d2d4210..3b5acc735 100644 --- a/gpsbabel/csv_util.h +++ b/gpsbabel/csv_util.h @@ -131,4 +131,4 @@ typedef struct { /****************************************************************************/ /* obligatory global struct */ /****************************************************************************/ -xcsv_file_t xcsv_file; +extern xcsv_file_t xcsv_file; diff --git a/gpsbabel/gcdb.c b/gpsbabel/gcdb.c index f5846882d..df49107d0 100644 --- a/gpsbabel/gcdb.c +++ b/gpsbabel/gcdb.c @@ -50,8 +50,8 @@ struct dbrec { static FILE *file_in; static FILE *file_out; static const char *out_fname; -struct pdb *opdb; -struct pdb_record *opdb_rec; +static struct pdb *opdb; +static struct pdb_record *opdb_rec; static char *tbuf = NULL; static char *tbufp = NULL; diff --git a/gpsbabel/gdb.c b/gpsbabel/gdb.c index e4f0d6090..e72cebab4 100644 --- a/gpsbabel/gdb.c +++ b/gpsbabel/gdb.c @@ -73,7 +73,7 @@ typedef enum { /* %%% local vars %%% */ -FILE *fin, *fout; +static FILE *fin, *fout; static char *fin_name, *fout_name; static int gdb_ver = 1; diff --git a/gpsbabel/geo.c b/gpsbabel/geo.c index f3b3ddcdb..5dadf4000 100644 --- a/gpsbabel/geo.c +++ b/gpsbabel/geo.c @@ -24,8 +24,8 @@ static char *nuke_placer; static waypoint *wpt_tmp; -FILE *fd; -FILE *ofd; +static FILE *fd; +static FILE *ofd; static arglist_t geo_args[] = { diff --git a/gpsbabel/globals.c b/gpsbabel/globals.c index e2329a9b5..2702cc679 100644 --- a/gpsbabel/globals.c +++ b/gpsbabel/globals.c @@ -22,7 +22,7 @@ #include "defs.h" -global_options global_opts; +global_options global_opts = {}; const char gpsbabel_version[] = VERSION; diff --git a/gpsbabel/google.c b/gpsbabel/google.c index 5d1456171..173417a8a 100644 --- a/gpsbabel/google.c +++ b/gpsbabel/google.c @@ -25,7 +25,7 @@ static char *script = NULL; static route_head *track_head; static void *desc_handle; -FILE *fd; +static FILE *fd; static int serial = 0; diff --git a/gpsbabel/gpilots.c b/gpsbabel/gpilots.c index ad661de23..4b1abe6d2 100644 --- a/gpsbabel/gpilots.c +++ b/gpsbabel/gpilots.c @@ -153,8 +153,8 @@ struct record static FILE *file_in; static FILE *file_out; static const char *out_fname; -struct pdb *opdb; -struct pdb_record *opdb_rec; +static struct pdb *opdb; +static struct pdb_record *opdb_rec; static char *dbname = NULL; diff --git a/gpsbabel/gpspilot.c b/gpsbabel/gpspilot.c index 3c28631bc..0ab9f1a5d 100644 --- a/gpsbabel/gpspilot.c +++ b/gpsbabel/gpspilot.c @@ -48,8 +48,8 @@ struct runways { static FILE *file_in; static FILE *file_out; static const char *out_fname; -struct pdb *opdb; -struct pdb_record *opdb_rec; +static struct pdb *opdb; +static struct pdb_record *opdb_rec; static char *dbname = NULL; static diff --git a/gpsbabel/gpx.c b/gpsbabel/gpx.c index 01f6a3df8..09afdabd4 100644 --- a/gpsbabel/gpx.c +++ b/gpsbabel/gpx.c @@ -40,7 +40,7 @@ static char *xsi_schema_loc = NULL; static char *gpx_email = NULL; static char *gpx_author = NULL; -vmem_t current_tag; +static vmem_t current_tag; static waypoint *wpt_tmp; static int cache_descr_is_html; diff --git a/gpsbabel/hsa_ndv.c b/gpsbabel/hsa_ndv.c index 647f5aa95..5b3a6811d 100644 --- a/gpsbabel/hsa_ndv.c +++ b/gpsbabel/hsa_ndv.c @@ -29,7 +29,7 @@ static int in_ChartWork = 0; static int in_Object = 0; static waypoint *wpt_tmp; -char *routeName = "ROUTENAME"; +static char *routeName = "ROUTENAME"; #define REPLACEMENT_SIRIUS_ATTR_SEPARATOR ';' #define ATTR_USRMRK "usrmrk" @@ -38,8 +38,8 @@ char *routeName = "ROUTENAME"; static void readVersion4( FILE* pFile); -FILE *fd; -FILE *ofd; +static FILE *fd; +static FILE *ofd; static arglist_t hsa_ndv_args[] = { diff --git a/gpsbabel/ignrando.c b/gpsbabel/ignrando.c index 3e7e2b1e2..1b3d233ca 100644 --- a/gpsbabel/ignrando.c +++ b/gpsbabel/ignrando.c @@ -34,7 +34,7 @@ static XML_Parser psr; #define MYNAME "IGNRando" -FILE *fin, *fout; +static FILE *fin, *fout; static route_head *track; static waypoint *wpt; diff --git a/gpsbabel/kml.c b/gpsbabel/kml.c index e71d66475..6416ea6ad 100644 --- a/gpsbabel/kml.c +++ b/gpsbabel/kml.c @@ -36,8 +36,8 @@ static int floating; static waypoint *wpt_tmp; -FILE *fd; -FILE *ofd; +static FILE *fd; +static FILE *ofd; typedef struct { double latitude; diff --git a/gpsbabel/magnav.c b/gpsbabel/magnav.c index 0e07af7e8..f60f86f7b 100644 --- a/gpsbabel/magnav.c +++ b/gpsbabel/magnav.c @@ -54,8 +54,8 @@ static FILE *file_out; static const char *out_fname; static void *mkshort_handle; -struct pdb *opdb; -struct pdb_record *opdb_rec; +static struct pdb *opdb; +static struct pdb_record *opdb_rec; static void rd_init(const char *fname) diff --git a/gpsbabel/magproto.c b/gpsbabel/magproto.c index ff234827d..442d36170 100644 --- a/gpsbabel/magproto.c +++ b/gpsbabel/magproto.c @@ -25,9 +25,9 @@ #include "defs.h" #include "magellan.h" -int bitrate = 4800; -int wptcmtcnt; -int wptcmtcnt_max; +static int bitrate = 4800; +static int wptcmtcnt; +static int wptcmtcnt_max; #define MYNAME "MAGPROTO" #define MAXCMTCT 200 diff --git a/gpsbabel/msroute.c b/gpsbabel/msroute.c index ec26e30b1..9cccb11e7 100644 --- a/gpsbabel/msroute.c +++ b/gpsbabel/msroute.c @@ -28,8 +28,8 @@ #undef OLE_DEBUG -FILE *fin; -char *fin_name; +static FILE *fin; +static char *fin_name; static arglist_t msroute_args[] = { diff --git a/gpsbabel/navicache.c b/gpsbabel/navicache.c index a2477749c..72ede63e6 100644 --- a/gpsbabel/navicache.c +++ b/gpsbabel/navicache.c @@ -25,8 +25,8 @@ static XML_Parser psr; static waypoint *wpt_tmp; -FILE *fd; -FILE *ofd; +static FILE *fd; +static FILE *ofd; static char *noretired = NULL; diff --git a/gpsbabel/nmn5.c b/gpsbabel/nmn5.c index 9186b6bb5..a6d00361f 100644 --- a/gpsbabel/nmn5.c +++ b/gpsbabel/nmn5.c @@ -33,7 +33,7 @@ #define NMN5_MAGIC 0x766d6170 /* vmap */ #define NMN5_ROUTE 0x49444154 /* IDAT */ -FILE *fd_in; +static FILE *fd_in; static struct pdb *pdb_in; static char *fname_in; diff --git a/gpsbabel/ozi.c b/gpsbabel/ozi.c index c6049891a..2de189f10 100644 --- a/gpsbabel/ozi.c +++ b/gpsbabel/ozi.c @@ -58,7 +58,7 @@ arglist_t ozi_args[] = { {0, 0, 0, 0, 0} }; -gpsdata_type ozi_objective; +static gpsdata_type ozi_objective; static char *ozi_ofname = NULL; diff --git a/gpsbabel/pathaway.c b/gpsbabel/pathaway.c index dfefb8f4a..3693b206c 100644 --- a/gpsbabel/pathaway.c +++ b/gpsbabel/pathaway.c @@ -38,12 +38,12 @@ #define PPDB_MAGIC_WPT 0x506f4c69 /* PoLi */ #define PPDB_MAGIC 0x4b6e5772 /* KwNr */ -FILE *fd_in, *fd_out; -struct pdb *pdb_in, *pdb_out; -char *fname_in, *fname_out; +static FILE *fd_in, *fd_out; +static struct pdb *pdb_in, *pdb_out; +static char *fname_in, *fname_out; static void *mkshort_handle; static gpsdata_type ppdb_type; -unsigned char german_release = 0; +static unsigned char german_release = 0; typedef struct ppdb_appdata { diff --git a/gpsbabel/position.c b/gpsbabel/position.c index 2df410826..75f0988df 100644 --- a/gpsbabel/position.c +++ b/gpsbabel/position.c @@ -38,7 +38,7 @@ static char *nosort = NULL; static char *maxctarg = NULL; static int maxct; -waypoint * home_pos; +static waypoint * home_pos; typedef struct { double distance; diff --git a/gpsbabel/quovadis.c b/gpsbabel/quovadis.c index 455d010a0..58b7e3b90 100644 --- a/gpsbabel/quovadis.c +++ b/gpsbabel/quovadis.c @@ -24,7 +24,7 @@ static FILE *file_in; static FILE *file_out; static const char *out_fname; -struct pdb *opdb; +static struct pdb *opdb; static int ct; static ubyte* rec_ptr = NULL; diff --git a/gpsbabel/tef_xml.c b/gpsbabel/tef_xml.c index 77975d0e0..a2e785981 100644 --- a/gpsbabel/tef_xml.c +++ b/gpsbabel/tef_xml.c @@ -34,8 +34,8 @@ static int waypoints = 0; static route_head *route = NULL; -FILE *fd; -FILE *ofd; +static FILE *fd; +static FILE *ofd; static char *routevia = NULL; diff --git a/gpsbabel/tiger.c b/gpsbabel/tiger.c index a2c398399..f6d2caa9f 100644 --- a/gpsbabel/tiger.c +++ b/gpsbabel/tiger.c @@ -30,7 +30,7 @@ static void *mkshort_whandle; #define MYNAME "GPSUTIL" static double maxlat, maxlon, minlat, minlon; -int rec_cnt; +static int rec_cnt; static char *nolabels = NULL; static char *genurl = NULL; static char *suppresswhite = NULL; @@ -45,9 +45,9 @@ static char *oldmarker = NULL; static char *newmarker = NULL; static char *unfoundmarker = NULL; -int scalev; -int short_length; -double thresh_days; +static int scalev; +static int short_length; +static double thresh_days; /* * The code bracketed by CLICKMAP is to generate clickable image maps diff --git a/gpsbabel/waypt.c b/gpsbabel/waypt.c index e1daa6d7c..bfc1f2b5e 100644 --- a/gpsbabel/waypt.c +++ b/gpsbabel/waypt.c @@ -23,7 +23,7 @@ #include "defs.h" #include "cet_util.h" -queue waypt_head; +queue waypt_head = {}; static unsigned int waypt_ct; static void *mkshort_handle; -- 2.30.2